##############################
#   敌人攻击   
#   by Jerry Yang      
#   UUZ0226            
#############################
import pygame
from pygame.sprite import Sprite

class EnemyAttack(Sprite):
    def __init__(self, ai_settings, screen):
        """在角色所处的位置创建一个技能对象"""
        super(EnemyAttack, self).__init__()
        
        self.filepath = ai_settings.filepath
        self.screen = screen
        self.screen_rect = screen.get_rect()
        self.image = pygame.image.load(self.filepath+'S2.png')
        self.rect = self.image.get_rect()
        self.rect.centerx = self.screen_rect.centerx
        self.rect.top = self.screen_rect.top+150
        self.y = float(self.rect.y)
        self.speed_factor = ai_settings.speed_factor
    
    def update(self):
        """向下移动"""
        #更新表示位置的小数值
        self.y += self.speed_factor
        #更新表示的rect的位置
        self.rect.y = self.y
        
    def draw_enemyattack(self):
        """在屏幕上绘制"""
        self.screen.blit(self.image, self.rect)
        